<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <h:head>
        <title>Supervisor - Search House</title>
        <link href="style.css" rel="stylesheet" type="text/css"></link>
        <div style="text-align: center;"><h:graphicImage url="/Images/back.png"></h:graphicImage></div>

    </h:head>
    <h:body>
        <h:form prependId="false">
            <div id="wrapper">
                <div id="logo">

                </div>
                <div id="header">
                    <!-- 		<div id="menu">
                    
                            </div>    -->
                </div>
                <div class="page">
                    <div id="page-bgtop">

                        <div id="dummy"></div>
                        <p:panel id="panelsidebar" header="Pages Menu">
                            <ui:include src="MenuSupervisor.xhtml"/>
                        </p:panel>

                        <!-- end #sidebar -->

                        <div id="content">
                            <p:panel header="Search House" id="panel">
                                <p:dataTable id="datatable" var="house" value="#{supervisorbean.houses}" paginator="true" rows="10"  
                                             selection="#{supervisorbean.selectedHouse}" selectionMode="single"  
                                             onRowSelectUpdate="display">  

                                    <f:facet name="header">  
                                        House List 
                                    </f:facet>  

                                    <p:column sortBy="#{house.type}" filterBy="#{house.type}">  
                                        <f:facet name="header">  
                                            <h:outputText value="Type" />  
                                        </f:facet>  
                                        <h:outputText value="#{house.type == 1 ? 'Rent' : 'Sale'}" />  
                                    </p:column>  

                                    <p:column sortBy="#{house.price}" filterBy="#{house.price}">  
                                        <f:facet name="header">  
                                            <h:outputText value="Price" />  
                                        </f:facet>  
                                        <h:outputText value="#{house.price}" />  
                                    </p:column>  

                                    <p:column sortBy="#{house.room_type}" filterBy="#{house.room_type}">  
                                        <f:facet name="header">  
                                            <h:outputText value="Room Type" />  
                                        </f:facet>  
                                        <h:outputText value="#{house.room_type}" />  
                                    </p:column>  

                                    <p:column sortBy="#{house.province}" filterBy="#{house.province}">  
                                        <f:facet name="header">  
                                            <h:outputText value="Province" />  
                                        </f:facet>  
                                        <h:outputText value="#{house.province}" />  
                                    </p:column> 

                                    <p:column sortBy="#{house.district}" filterBy="#{house.district}">  
                                        <f:facet name="header">  
                                            <h:outputText value="District" />  
                                        </f:facet>  
                                        <h:outputText value="#{house.district}" />  
                                    </p:column>

                                    <p:column>  
                                        <p:commandButton update="panel" action="#{supervisorbean.deleteHouse}"  
                                                         image="ui-icon ui-icon-close">  
                                            <f:setPropertyActionListener value="#{house}"  
                                                                         target="#{supervisorbean.selectedHouse}" />  
                                        </p:commandButton>  
                                    </p:column> 
                                    <p:column>

                                        <p:commandButton ajax="false" action="#{supervisorbean.showHouseDetails()}"  
                                                         image="ui-icon ui-icon-arrowrefresh-1-w">  
                                            <f:setPropertyActionListener value="#{house}"  
                                                                         target="#{supervisorbean.selectedHouse}" />  
                                        </p:commandButton>  
                                    </p:column>

                                </p:dataTable>  
                                <p:commandButton ajax="false" action="#{supervisorbean.showHouseDetails()}"  
                                                         image="ui-icon ui-icon-arrowrefresh-1-w">  
                                           
                                        </p:commandButton>  
                                
                                 <p:commandButton onclick="confirmation.show()" type="button"
                                                 image="ui-icon ui-icon-close">  

                                </p:commandButton>  
                                
                                
                                  <p:confirmDialog message="Are you sure about deleting estate?" 
                                                 header="Initiating delete process" severity="alert" widgetVar="confirmation">  

                                    <p:commandButton value="Yes Sure" update="panel" oncomplete="confirmation.hide()"  
                                                     action="#{supervisorbean.deleteHouse()}"   />  
                                    <p:commandButton value="Not Yet" onclick="confirmation.hide()" type="button" />   

                                </p:confirmDialog>  
                                <p:messages/>
                            </p:panel>  

                        </div>
                        <!-- end #content -->

                        <div style="clear: both;">&nbsp;</div>
                    </div>

                    <!-- end #page -->

                </div>
                <div id="footer-bgcontent">
                    <div id="footer" align="center">
                        <p>İstanbul Teknik Üniversitesi - Software Engineering Course - Real Estate Management</p>
                    </div>
                </div>
                <!-- end #footer -->
            </div>

        </h:form>
    </h:body>
</html>